Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve dev env experience after Ruby version updates #11670

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

h-m-m
Copy link
Contributor

@h-m-m h-m-m commented Dec 18, 2024

🛠 Summary of changes

After #11605 was merged, @ajfarkas and I noticed that a couple small changes may help developers update their local dev environments.

  • Ruby projects usually have [email protected] listed in their Brewfile to ensure older Ruby versions are able to build against it. I'm removing it assuming that's why it was added. Of note:
    • We're not on a Ruby version that requires it anymore
    • These days, tools like asdf and rbenv leverage the ruby-build Homebrew formula to manage Ruby-specific OpenSSL dependencies when installing older versions
  • Currently, local devs would only install the Foreman gem when running bin/setup, a script that also clobbers any local db entries. Adding the Foreman to the gemfile like this means that make update will also make sure an appropriate version of Foreman is always installed without dropping db tables

I was tempted to remove the Foreman-specific step from bin/setup entirely. I wasn't sure if it's called anywhere automatically, like referenced in an important Terraform script or the like, so I left it alone for now.

@@ -96,6 +96,8 @@ gem 'zxcvbn', '0.1.12'
group :development do
gem 'better_errors', '>= 2.5.1'
gem 'derailed_benchmarks'
# Putting foreman here saves developers from having bin/setup when the Ruby version changes
gem 'foreman', require: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to change the foreman invocation in the Makefile to bundle exec foreman in the case the gem is installed locally. However I think that will error out if the gem is installed system-wide.

Copy link
Contributor Author

@h-m-m h-m-m Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. In my environment, I tried adding this line to the Gemfile to see if using bundle exec foreman was required, and I didn't need it. I am using rbenv, and I'd like to see if anyone not using rbenv also finds this okay.

Here's what happened when I added it to the Gemfile before and after running `bundle install`
➜  identity-idp git:(main) ✗ make run
yarn generate-browsers-json
yarn run v1.22.22
$ ./scripts/generate-browsers-json.js
✨  Done in 0.19s.
foreman start -p 3000
rbenv: foreman: command not found

The `foreman' command exists in these Ruby versions:
  3.2.0
  3.2.2
  3.3.0
  3.3.1
  3.3.4

make: *** [run] Error 127
➜  identity-idp git:(main) ✗ bundle
Fetching gem metadata from https://rubygems.org/........
Resolving dependencies...
Fetching foreman 0.88.1
Installing foreman 0.88.1
WARN: Unresolved or ambiguous specs during Gem::Specification.reset:
      stringio (>= 0)
      Available/installed versions of this gem:
      - 3.1.2
      - 3.1.1
WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
Please report a bug if this causes problems.
Bundle complete! 127 Gemfile dependencies, 279 gems now installed.
Gems in the groups 'deploy' and 'production' were not installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
➜  identity-idp git:(main) ✗ make run
foreman start -p 3000
13:22:49 web.1    | started with pid 5871
13:22:49 worker.1 | started with pid 5872
13:22:49 js.1     | started with pid 5873
13:22:49 css.1    | started with pid 5874
13:22:49 js.1     | yarn run v1.22.22
13:22:49 css.1    | yarn run v1.22.22

[etc]

Copy link
Contributor

@mitchellhenke mitchellhenke Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Foreman recommends against putting it in the Gemfile:

Ruby users should take care not to install foreman in their project's Gemfile. See this wiki article for more details.

The reasoning described in the wiki article seems sensible enough to me to not include it.

changelog: Internal, Local Development, Improving development experience after recent Ruby version upgrade
@h-m-m h-m-m force-pushed the hmm/ruby-3.3.6/dev-config-nice-to-haves branch from 62df362 to 075bd96 Compare December 18, 2024 19:12
@@ -2,6 +2,5 @@ brew 'postgresql@14'
brew 'redis'
brew 'node@22'
brew 'yarn'
brew '[email protected]'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of our deployed environments still use openssl 1.1, so I think it'd be preferable to keep it as-is for consistency.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to resolve the fact that this prevents engs from deploying idp on their local environments?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the dependency for the environments that still use openssl 1.1? Login.gov is very good about keeping important things like Ruby versions up to date, which is why this change felt safe to me.

Copy link
Contributor

@mitchellhenke mitchellhenke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have done this is as a full review, but I added a couple comments that I consider blockers at the moment.

@ajfarkas
Copy link
Member

Additional context is that having [email protected] in our Brewfile prevents successful install locally, with the following error:
Error: [email protected] has been disabled because it is not supported upstream! It was disabled on 2024-10-24.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants